#ifdef USE_PORTABLE_API

MaybeLocal<Script> ScriptCompiler::Compile(Isolate* v8_isolate,
                                           const uint8_t* data, int length,
                                           CompileOptions options,
                                           NoCacheReason no_cache_reason,
                                           std::string filename) {
  v8::internal::StdoutStream{} << "[pbc] Enter ScriptCompiler::Compile\n";
  Utils::ApiCheck(data != nullptr, "v8::ScriptCompiler::Compile",
                  "data must be non-nullptr");

  v8::HandleScope handle_scope(v8_isolate);
  v8::Local<v8::Context> context = v8_isolate->GetCurrentContext();
  v8::Context::Scope scope(context);

  v8::MaybeLocal<v8::UnboundScript> maybe_script =
      portable::PortableTransformUnboundInternal(
          v8_isolate, data, length, false, options,
          nullptr /* todo:add code cache here */, filename);
  v8::Local<v8::UnboundScript> result;
  if (!maybe_script.ToLocal(&result)) {
    CHECK(false);
  }
  return result->BindToCurrentContext();
}

#endif